package com.pilipili.service;

import com.pilipili.dao.commentMapper;
import com.pilipili.pojo.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class commentServiceImpl implements commentService{

    @Autowired
    commentMapper commentMapper;
    @Override
    @Cacheable(cacheNames = "Comment")
    public List<Comment> selectComment(Comment comment) {
        return commentMapper.selectComment(comment);
    }

    @Override
    @CacheEvict(value="Comment", allEntries=true)
    public int deleteComment(Integer comment_id) {
        return commentMapper.deleteComment(comment_id);
    }

    @Override
    @CacheEvict(value="Comment", allEntries=true)
    public int insertComment(Comment comment) {
        return commentMapper.insertComment(comment);
    }

    @Override
    @CacheEvict(value="Comment", allEntries=true)
    public int updateComment(Comment comment) {
        return commentMapper.updateComment(comment);
    }
}
